﻿
namespace WeiboWPSdk {
    /// <summary>
    /// 微博API参数
    /// </summary>
    public class WeiboParameter {
        public WeiboParameter() { }
        public WeiboParameter(string name, string value) {
            Name = name;
            Value = value;
        }
        public WeiboParameter(string name, bool value) {
            Name = name;
            Value = value ? "1" : "0";
        }
        public WeiboParameter(string name, int value) {
            Name = name;
            Value = value.ToString();
        }
        public WeiboParameter(string name, long value) {
            Name = name;
            Value = value.ToString();
        }
        public WeiboParameter(string name, byte[] value) {
            Name = name;
            Value = value;
        }
        public WeiboParameter(string name, object value) {
            Name = name;
            Value = value;
        }

        /// <summary>
        /// 参数名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 参数值
        /// </summary>
        public object Value { get; set; }
        /// <summary>
        /// 获取参数值是否为二进制参数（如图片、文件等）
        /// </summary>
        public bool IsBinaryData {
            get {
                return Value != null && Value.GetType() == typeof(byte[]);
            }
        }
    }
}
